From 7c0fc730a37e743b6cea08b4fdcb4e4c9d04e8d8 Mon Sep 17 00:00:00 2001 From: "kfraser@ubuntu.eng.hq.xensource.com" Date: Tue, 5 Sep 2006 18:36:23 -0700 Subject: [PATCH] [XEN] gnttab: Read domid/flags atomically. This more neatly matches how the two adjacent fields in the grant-table entry are accessed by the cmpxchg() function. Signed-off-by: Herbert Xu --- xen/common/grant_table.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c index 68e2bf62d7..be393d0dcb 100644 --- a/xen/common/grant_table.c +++ b/xen/common/grant_table.c @@ -184,8 +184,7 @@ __gnttab_map_grant_ref( (!(op->flags & GNTMAP_readonly) && !(act->pin & (GNTPIN_hstw_mask|GNTPIN_devw_mask))) ) { - scombo.shorts.flags = sha->flags; - scombo.shorts.domid = sha->domid; + scombo.word = *(u32 *)&sha->flags; /* * This loop attempts to set the access (reading/writing) flags @@ -556,8 +555,7 @@ gnttab_prepare_for_transfer( sha = &rgt->shared[ref]; - scombo.shorts.flags = sha->flags; - scombo.shorts.domid = sha->domid; + scombo.word = *(u32 *)&sha->flags; for ( ; ; ) { @@ -774,8 +772,7 @@ __acquire_grant_for_copy( if ( !act->pin || (!readonly && !(act->pin & (GNTPIN_devw_mask|GNTPIN_hstw_mask))) ) { - scombo.shorts.flags = sha->flags; - scombo.shorts.domid = sha->domid; + scombo.word = *(u32 *)&sha->flags; for ( ; ; ) { -- 2.30.2